package com.codeyang.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.codeyang.domain.Sku;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 描述: TO-删除标志-DO
 *
 * @author CodeYang_Site
 * @version 2021/5/24 22:34
 */
@Mapper
public interface SkuMapper extends BaseMapper<Sku> {

    @Update(" UPDATE sku set actual_stocks = actual_stocks + #{count} where sku_id = #{skuId} and actual_stocks + #{count} >=0 ")
    int changeStock(@Param("skuId") Long skuId, @Param("count") Integer count);

}